const router = require('koa-router')()
const db = require('../dal/mongo')

router.get('/', async (ctx, next) => {
  await ctx.render('index', {
    title: 'Hello Koa 2!'
  })
})

router.get('/login1', async (ctx, next) => {
    const data = ctx.query
    console.log('ctx:',ctx.query)
    const res = await db.find('account',data)
    if(res.length > 0)
    console.log(res)
    ctx.body = {
        data:res
    }
})

module.exports = router
